home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / CIncludes / perf.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-28  |  3.0 KB  |  98 lines  |  [TEXT/MPS ]

  1. /************************************************************
  2.  
  3.     Perf.h 
  4.     
  5.     version 2.0
  6.     C Interface to PerformLib.o
  7.  
  8.     Copyright Apple Computer, Inc.    1986-1996
  9.     All rights reserved
  10.  
  11. ************************************************************/
  12.  
  13.  
  14. #ifndef __PERF__
  15. #define __PERF__
  16.  
  17. #ifndef __TYPES__
  18. #include <Types.h>
  19. #endif
  20.  
  21. #ifndef __CONDITIONALMACROS__
  22. #include <ConditionalMacros.h>
  23. #endif
  24.  
  25. #if GENERATINGPOWERPC
  26. #error "Perf.h is only valid for 680x0 code."
  27. #endif
  28.  
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32.  
  33. struct TPerfGlobals {
  34.     long startROM;                /*ROM Base*/
  35.     long romHits;                /*used if MeasureROM is false*/
  36.     long misses;                /*count of PC values outside measured memory*/
  37.     long (*segArray)[1];        /*array of segment handles*/
  38.     long (*sizeArray)[1];        /*array of segment sizes*/
  39.     short (**idArray)[1];        /*array of segment rsrc IDs*/
  40.     long (*baseArray)[1];        /*array of offsets to counters for each segment*/
  41.     long (*samples)[1];         /*samples buffer*/
  42.     long buffSize;                /*size of samples buffer in bytes*/
  43.     short timeInterval;         /*number of clock intervals between interrupts*/
  44.     short bucketSize;            /*size of buckets power of 2*/
  45.     short log2buckSize;         /*used in CvtPC*/
  46.     short pcOffset;             /*offset to the user PC at interrupt time.*/
  47.     short numMeasure;            /*# Code segments (w/o jump table)- ROM etc.*/
  48.     short firstCode;            /*index of first Code segment*/
  49.     Boolean takingSamples;        /*true if sampling is enabled.*/
  50.     Boolean measureROM;
  51.     Boolean measureCode;
  52.     short ramSeg;                /*index of "segment" record to cover RAM > 0 if RAM (misses) are to be bucketed.*/
  53.     long ramBase;                /*beginning of RAM being measured.*/
  54.     short measureRAMbucketSize;
  55.     short measureRAMlog2buckSize;
  56.     short romVersion;
  57.     short vRefNum;                /*Volume where the report file is to be created*/
  58.     Boolean volumeSelected;     /*True if user selects the report file name*/
  59.     Str255 rptFileName;         /*Report file name*/
  60.     Str255 rptFileCreator;        /*Report File Creator*/
  61.     Str255 rptFileType;         /*Report File type*/
  62.     ResType getResType;         /*Resource type*/
  63. };
  64.  
  65. typedef struct TPerfGlobals TPerfGlobals;
  66. typedef TPerfGlobals *TP2PerfGlobals;
  67.  
  68. /* PerfGlobals are declared as a record, so main program can allocate
  69. as globals, desk accessory can add to globals allocated via pointer,
  70. print driver can allocate via low memory, etc. */
  71.  
  72. pascal Boolean InitPerf(TP2PerfGlobals *thePerfGlobals,short timerCount,
  73.     short codeAndROMBucketSize,Boolean doROM,Boolean doAppCode,const Str255 appCodeType,
  74.     short romID,const Str255 romName,Boolean doRAM,long ramLow,long ramHigh,
  75.     short ramBucketSize);                                
  76.     
  77. /* called once to setup Performance monitoring */
  78.  
  79. pascal void TermPerf(TP2PerfGlobals thePerfGlobals);    
  80.  
  81. /* if InitPerf succeeds then TermPerf must be called before terminating program.  */
  82.  
  83. pascal Boolean PerfControl(TP2PerfGlobals thePerfGlobals,Boolean turnOn);
  84.  
  85. /*
  86.     Call this to turn off/on measuring.
  87.      Returns previous state.
  88. */
  89.  
  90. pascal short PerfDump(TP2PerfGlobals thePerfGlobals,const Str255 reportFile,
  91.     Boolean doHistogram,short rptFileColumns);            /* Call this to dump the statistics into a file. */
  92.  
  93. #ifdef __cplusplus
  94. } /* extern c */
  95. #endif
  96.  
  97. #endif
  98.